import Vue from 'vue'
import Router from 'vue-router'
import {getToken} from "../../../util";

Vue.use(Router)

const router = new Router({
  routes: [
    {
      path: '/',
      name: 'Login',
      component: () => import('@/components/page/Login.vue'),
    }
  ],
})

router.beforeEach((to, from, next) => {
  const token = getToken()
  console.log(token)
  if (token) {
    window.location.href = '/home.htm'
    return
  }
  next()
})

export default router
